home *** CD-ROM | disk | FTP | other *** search
/ Fischer's Erotic Encyclopedia / Eros.mdf / TEMPLE / 00051_Andy's Global Scripts.ls < prev    next >
Encoding:
Text File  |  1996-11-07  |  3.4 KB  |  150 lines

  1. global gDebugOn
  2.  
  3. on SetVisibles first, last, state
  4.   repeat with I = first to last
  5.     set the visible of sprite I to state
  6.   end repeat
  7. end
  8.  
  9. on SetPuppets first, last, state
  10.   repeat with I = first to last
  11.     puppetSprite(I, state)
  12.   end repeat
  13. end
  14.  
  15. on ReturnDigits what
  16.   set what to string(what)
  17.   set num to the number of chars in what
  18.   if num = 2 then
  19.     set what to "0" & what
  20.   end if
  21.   if num = 1 then
  22.     set what to "00" & what
  23.   end if
  24.   return what
  25. end
  26.  
  27. on ResetAudio
  28.   repeat with I = 1 to 3
  29.     sound stop I
  30.     set the volume of sound I to 255
  31.     puppetSound(I, 0)
  32.   end repeat
  33. end
  34.  
  35. on Wait HowLong
  36.   set start to the timer
  37.   repeat while (the timer - start) < HowLong
  38.     nothing()
  39.   end repeat
  40. end
  41.  
  42. on SetCursors first, last, what
  43.   repeat with I = first to last
  44.     set the cursor of sprite I to what
  45.   end repeat
  46. end
  47.  
  48. on GoPlaces where
  49.   SetPuppets(1, 48, 0)
  50.   SetVisibles(1, 48, 1)
  51.   puppetTempo(30)
  52.   if not voidp(where) then
  53.     go(where)
  54.   end if
  55. end
  56.  
  57. on NameButtons first, last, name, extension
  58.   repeat with I = first to last
  59.     set the name of cast I to name & I - first + 1 & extension
  60.   end repeat
  61. end
  62.  
  63. on button what
  64.   set ButtonNum to the clickOn
  65.   set ButtonName to the name of cast the castNum of sprite ButtonNum
  66.   set ButtonCastNum to the castNum of sprite ButtonNum
  67.   if ButtonName = EMPTY then
  68.     set ButtonCastNumDown to ButtonCastNum
  69.   else
  70.     if the name of cast (ButtonCastNum + 1) contains ButtonName then
  71.       set ButtonCastNumDown to ButtonCastNum + 1
  72.     else
  73.       if ButtonName contains the name of cast (ButtonCastNum - 1) then
  74.         set ButtonCastNumDown to ButtonCastNum - 1
  75.       else
  76.         set ButtonCastNumDown to the number of cast (ButtonName & "Down")
  77.       end if
  78.     end if
  79.   end if
  80.   if ButtonCastNumDown = -1 then
  81.     set ButtonCastNumDown to ButtonCastNum
  82.   end if
  83.   set prePuppet to the puppet of sprite ButtonNum
  84.   puppetSprite(ButtonNum, 1)
  85.   set the castNum of sprite ButtonNum to ButtonCastNumDown
  86.   updateStage()
  87.   set quickPress to the timer
  88.   repeat while the mouseDown
  89.     if rollOver(ButtonNum) then
  90.       set the castNum of sprite ButtonNum to ButtonCastNumDown
  91.     else
  92.       set the castNum of sprite ButtonNum to ButtonCastNum
  93.     end if
  94.     updateStage()
  95.   end repeat
  96.   if (quickPress - the timer) < 8 then
  97.     Wait(4)
  98.   end if
  99.   set the castNum of sprite ButtonNum to ButtonCastNum
  100.   puppetSprite(ButtonNum, prePuppet)
  101.   updateStage()
  102.   if rollOver(ButtonNum) then
  103.     updateStage()
  104.     if not voidp(what) then
  105.       if word 1 to 2 of what = "go to" then
  106.         if char 1 to 6 of word 3 of what = "marker" then
  107.           do(what)
  108.         else
  109.           if char 1 to 9 of word 3 to 4 of what = "the frame" then
  110.             do(what)
  111.           else
  112.             go(word 3 to 127 of what)
  113.           end if
  114.         end if
  115.       else
  116.         if word 1 of what = "goplaces" then
  117.           GoPlaces(word 2 to 127 of what)
  118.         else
  119.           do(what)
  120.         end if
  121.       end if
  122.     end if
  123.     return 1
  124.   end if
  125. end
  126.  
  127. on ForceRange value, min, max, alert
  128.   if not voidp(min) then
  129.     if value < min then
  130.       set value to min
  131.       if alert then
  132.         if gDebugOn then
  133.           alert("Forcerange replaced value " & value & " with " & min)
  134.         end if
  135.       end if
  136.     end if
  137.   end if
  138.   if not voidp(max) then
  139.     if value > max then
  140.       set value to max
  141.       if alert then
  142.         if gDebugOn then
  143.           alert("Forcerange replaced value " & value & " with " & min)
  144.         end if
  145.       end if
  146.     end if
  147.   end if
  148.   return value
  149. end
  150.